home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / remote.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  6.1 KB  |  149 lines

  1. *remote.txt*    For Vim version 6.0.  Last change: 2001 Sep 17
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Vim client-server communication                *client-server*
  8.  
  9. 1. Common functionality        |clientserver|
  10. 2. X11 specific items        |x11-clientserver|
  11. 3. MS-Windows specific items    |w32-clientserver|
  12.  
  13. {Vi does not have any of these commands}
  14.  
  15. ==============================================================================
  16. 1. Common functionality                    *clientserver*
  17.  
  18. When compiled with the |+clientserver| option, Vim can act as a command
  19. server.  It accepts messages from a client and executes them.  At the same
  20. time, Vim can function as a client and send commands to a Vim server.
  21.  
  22. The following command line arguments are available:
  23.  
  24.     argument            meaning    ~
  25.  
  26.    --remote [+{cmd}] {file} ...                    *--remote*
  27.                 Open the file list in a remote
  28.                 Vim. The rest of the command line
  29.                 is taken as the file list.  Thus any
  30.                 non-file arguments must come before this.
  31.    --remote-wait [+{cmd}] {file} ...                *--remote-wait*
  32.                 As above, but wait for files to
  33.                 complete (unload) in remote Vim.
  34.                                 *--servername*
  35.    --servername {name}        Send to or become the server {name}
  36.                                 *--remote-send*
  37.    --remote-send {keys}        Send {keys} to server and exit.
  38.                                 *--remote-expr*
  39.    --remote-expr {expr}        Evaluate {expr} in server and
  40.                 print the result on stdout.
  41.                                 *--serverlist*
  42.    --serverlist            Output a list of server names.
  43.  
  44.  
  45. SERVER NAME
  46.  
  47. By default Vim will try to register the name under which it was invoked (gvim,
  48. egvim ...).  This can be overridden with the --servername argument.  If the
  49. specified name is not available, a postfix is applied until a free name is
  50. encountered, ie. "gvim1" for the second invocation of gvim on a particular
  51. X-server.  The resulting name is available in the servername builtin variable
  52. |v:servername|.  The case of the server name is ignored, thus "gvim" and
  53. "GVIM" are considered equal.
  54.  
  55. When Vim is invoked with --remote, --remote-wait or --remote-send it will try
  56. to locate the server name determined by the invocation name and --servername
  57. argument as described above.  If an exact match is not available, the first
  58. server with the number postfix will be used.  If a name with the number
  59. postfix is specified with the --servername argument, it must match exactly.
  60.  
  61. If no server can be located and --remote or --remote-wait was used, Vim will
  62. start up according to the rest of the command line and do the editing by
  63. itself.  This way it is not necessary to know whether gvim is already started
  64. when sending command to it.
  65.  
  66. The --serverlist argument will cause Vim to print a list of registered command
  67. servers on the standard output (stdout) and exit.
  68.  
  69. Win32 Note: Making the Vim server go to the foreground doesn't always work,
  70. because MS-Windows doesn't allow it.  The client will move the server to the
  71. foreground when using the --remote or --remote-wait argument and the server
  72. name starts with "g".
  73.  
  74.  
  75. REMOTE EDITING
  76.  
  77. The --remote argument will cause a |:drop| command to be constructed from the
  78. rest of the command line and sent as described above.
  79. The --remote-wait argument does the same thing and additionally sets up to
  80. wait for earch of the files to have been edited.  This uses the BufUnload
  81. event, thus as soon as a file has been unloaded, Vim assumes you are done
  82. editing it.
  83. Note that the --remote and --remote-wait arguments will consume the rest of
  84. the command line.  Ie. all remaining arguments will be regarded as filenames.
  85. You can not put options there!
  86.  
  87.  
  88. FUNCTIONS
  89.  
  90. There are a number of VimL functions for scripting the command server.  See
  91. the description in |eval.txt| or use CTRL-] on the function name to jump to
  92. the full explanation.
  93.  
  94.     synopsis                     explanation ~
  95.     remote_expr( server, string, idvar)      send expression
  96.     remote_send( server, string, idvar)      send key sequence
  97.     serverlist()                 get a list of available servers
  98.     remote_peek( serverid, retvar)         check for reply string
  99.     remote_read( serverid)             read reply string
  100.     server2client( serverid, string)         send reply string
  101.     remote_foreground( server)             bring server to the front
  102.  
  103. See also the explanation of |CTRL-\_CTRL-N|.  Very useful as a leading key
  104. sequence.
  105. The {serverid} for server2client() can be obtained with expand("<client>")
  106.  
  107. ==============================================================================
  108. 2. X11 specific items                    *x11-clientserver*
  109.                     *E247* *E248* *E249* *E251* *E258* *E277*
  110.  
  111. The communication between client and server goes through the X server.  The
  112. display of the Vim server must be specified.  The usual protection of the X
  113. server is used, you must be able to open a window on the X server for the
  114. communication to work.  It is possible to communicate between different
  115. systems.
  116.  
  117. By default, a GUI Vim will register a name on the X-server by which it can be
  118. addressed for subsequent execution of injected strings.  Vim can also act as
  119. a client and send strings to other instances of Vim on the same X11 display.
  120.  
  121. When an X11 GUI Vim (gvim) is started, it will try to register a send-server
  122. name on the 'VimRegistry' property on the root window.
  123.  
  124. A non GUI Vim with access to the X11 display (|xterm-clipboard| enabled), can
  125. also act as a command server if a server name is explicitly given with the
  126. --servername argument.
  127.  
  128. An empty --servername argument will cause the command server to be disabled.
  129.  
  130. To send commands to a Vim server from another application, read the source
  131. file src/if_xcmdsrv.c, it contains some hints about the protocol used.
  132.  
  133. ==============================================================================
  134. 2. Win32 specific items                    *w32-clientserver*
  135.  
  136. Every Win32 Vim can work as a server, also in the console.  You do not need a
  137. version compiled with OLE.  Windows messages are used, this works on any
  138. version of MS-Windows.  But only communication within one system is possible.
  139.  
  140. Since MS-Windows messages are used, any other application should be able to
  141. communicate with a Vim server.  An alternative is using the OLE functionality
  142. |ole-interface|.
  143.  
  144. When using gvim, the --remote-wait only works properly this way: >
  145.  
  146.     start /w gvim --remote-wait file.txt
  147. <
  148.  vim:tw=78:sw=4:ts=8:ft=help:norl:
  149.